import MyArrayList.MyArrayList;

//test中顺序表元素以包装类Double示例
public class Test {
    public static void main(String[] args) {
        MyArrayList<Double> myArrayList=new MyArrayList<Double>();
        Double element1 =1.0;
        Double element2 =2.0;
        Double element3 =3.0;
        Double element4 =4.0;
        //增添元素示例
        myArrayList.add(element1);
        myArrayList.add(element2);
        myArrayList.add(element3);
        myArrayList.display();
        System.out.println("*************");

        //删除元素示例
        myArrayList.remove(1.0);
        myArrayList.display();
        System.out.println("*************");

        //查找元素示例
       if(myArrayList.contains(2.0)){
           System.out.println("找到2.0了");
       }
        System.out.println("它的下标是"+myArrayList.indexOf(2.0));
        System.out.println("*************");

        //设定元素示例
        myArrayList.set(1,element4);
        myArrayList.display();
        System.out.println("*************");

        //获取元素示例
        System.out.println("下标为1的元素为"+myArrayList.get(1));
        System.out.println("*************");

        //清空顺序表示例
        myArrayList.clear();
        myArrayList.display();

        //添加元素不合法案例
        //myArrayList.add(1000,element4);


    }
}